<template>
  <div class="iInfo" element-loading-text="加载中" v-loading="loading">
    <div class="flex">
      <div class="lumpBox">
        <div class="Lbox-form" style="border-bottom:0">
          <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
            <el-tab-pane label="生产单管理" name="first"></el-tab-pane>
            <el-tab-pane label="已驳回单据" name="second"></el-tab-pane>
            <el-tab-pane label="完工生产单" name="third"></el-tab-pane>
          </el-tabs>
        </div>
        <div class="Lbox-form">
          <el-form :inline="true">
            <el-form-item label="筛选:">
              <el-input placeholder="请输入账号名称" clearable></el-input>
            </el-form-item>
            <el-form-item>
              <el-button icon="el-icon-search" type="primary">查询</el-button>
            </el-form-item>
          </el-form>
        </div>
        <div class="Lbox-title">
          <h2></h2>
          <div style="padding:10px 0;">
            <el-button type="primary">刷新</el-button>
            <el-button @click="addmaterial" icon="el-icon-plus" type="primary">添加</el-button>
            <el-button type="primary">导出审核日志</el-button>
          </div>
        </div>
        <div>
          <el-table :data="list" border default-expand-all>
            <el-table-column align="center" label="生产单号" prop="id"></el-table-column>
            <el-table-column align="center" label="业务员" prop="apply_dept_name"></el-table-column>
            <el-table-column align="center" label="备货" prop="warehouse_name"></el-table-column>
            <el-table-column align="center" label="型号" prop="product_name"></el-table-column>
            <el-table-column align="center" label="生产物料类别" prop="audit_name"></el-table-column>
            <el-table-column align="center" label="生产数量" prop="warehouse_number"></el-table-column>
            <el-table-column align="center" label="入库数量" prop="product_number"></el-table-column>
            <el-table-column align="center" label="下单日期" prop="time"></el-table-column>
            <el-table-column fixed="right" label="操作" width="350">
              <template slot-scope="scope">
                <el-button size="small">修改生产计划</el-button>
                <el-button size="small">审核</el-button>
                <el-button size="small">反审核</el-button>
                <el-button size="small">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-pagination :current-page="page" :total="total" @current-change="currentChange" class="Lpage" layout="prev,pager,next"></el-pagination>
        </div>

        <el-dialog title="信息" :visible.sync="dialogVisible" width="30%">
          <span>选择是否管理销货单</span>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="salesVisible=true">关 联</el-button>
            <el-button @click="$router.push({ path: '/add_up' })">不关联,直接下单</el-button>
          </span>
        </el-dialog>
        <el-dialog title="请选择销货单" :visible.sync="salesVisible" width="60%">
          <span style="color:red">选择下列一项</span>
          <el-table :data="list" @row-click="tableshowclick">
            <el-table-column align="center" label="生产单号" prop="id"></el-table-column>
            <el-table-column align="center" label="业务员" prop="apply_dept_name"></el-table-column>
            <el-table-column align="center" label="备货" prop="warehouse_name"></el-table-column>
            <el-table-column align="center" label="型号" prop="product_name"></el-table-column>
            <el-table-column align="center" label="生产物料类别" prop="audit_name"></el-table-column>
            <el-table-column align="center" label="生产数量" prop="warehouse_number"></el-table-column>
            <el-table-column align="center" label="入库数量" prop="product_number"></el-table-column>
            <el-table-column align="center" label="下单日期" prop="time"></el-table-column>
          </el-table>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "account",
  data() {
    return {
      data: "",
      list:[],
      page: 1,
      total: 1,
      table_height: 0,
      loading: false,
      activeName: "first",
      dialogVisible: false,
      salesVisible: false,
    };
  },
  components: {},
  created() {
    this.$emit("pass", "/account");
    axios.get("/api/panghu").then((data) => {
      this.data = data.data.data;
      this.list = this.data.material.dataList;
      console.log(this.data);
    });
  },
  mounted() {},
  methods: {
    currentChange(num) {},
    handleClick(tab, event) {
      // console.log(tab, event);
    },
    addmaterial() {
      this.dialogVisible = true;
    },
    relevance() {},
    tableshowclick(val) {
      console.log(val);
      this.$router.push({
        name: "add_up",
        params: {
          id: val.id,
        },
      });
    },
  },
};
</script>
